import { Space, TableColumnsType, Tooltip, InputNumber, message, Badge, Typography, Tag, Flex } from 'antd'
import { NavigateFunction } from 'react-router-dom'
import { IntentOrderVO as ITableData } from './types'
import { intentBadgeColorMap, INTENT_STATUS_TEXT, ORDER_STATUS_TEXT } from '@/constant/purchase'
import PermissionLink from '@/components/PermissionLink'
import { DeleteOutlined, EditOutlined } from '@ant-design/icons'
import { debounce } from '@/utils/util'
const TagTextMap: Record<string, string> = {
  1: '企划驳回',
  3: '供应链驳回',
  4: '交期延迟',
  5: '交期提前',
  6: '价格上浮',
  7: '供应商差异',
}
export const useIndexColumns = ({
  navigate,
  onReply,
  onEditTime,
  onEditRsTime,
  onEditInOut,
  onDelOrder,
  onViewLogs,
  onRejectOrder,
  canEditPlanDate,
  canEditInOrOut,
  setstatusFlag,
}: {
  navigate: NavigateFunction
  onReply: (info: ITableData, sendReq: boolean) => void
  onEditTime: (info: ITableData) => void
  onEditRsTime: (info: ITableData) => void
  onEditInOut: (info: ITableData & { inorout: 1 | 2 }) => void
  onDelOrder: (info: ITableData) => void
  onViewLogs: (info: ITableData) => void
  onRejectOrder: (info: ITableData) => void
  canEditPlanDate: boolean
  canEditInOrOut: boolean
  setstatusFlag: React.Dispatch<React.SetStateAction<boolean>>
}): TableColumnsType<ITableData> => [
  {
    title: '意向采购单号',
    dataIndex: 'intentOrderCode',
    key: 'intentOrderCode',
    align: 'center',
    width: 120,
    render: (info) => {
      return info ? info : '-'
    },
  },
  {
    title: '大类',
    dataIndex: 'firstClassConfigName',
    key: 'firstClassConfigName',
    align: 'center',
    width: 100,
    render: (info) => {
      return info ? info : '-'
    },
  },
  {
    title: '订单类型',
    dataIndex: 'orderType',
    key: 'orderType',
    align: 'center',
    width: 80,
    render: (info) => {
      return info == 0 ? '首单' : info == 1 ? '返单' : '-'
    },
  },
  {
    title: '采购方式',
    dataIndex: 'purchaseType',
    key: 'purchaseType',
    align: 'center',
    width: 80,
    render: (info) => {
      return info == 0 ? '集采' : info == 1 ? '现采' : '-'
    },
  },
  {
    title: '意向订单时间',
    dataIndex: 'intentOrderDate',
    key: 'intentOrderDate',
    align: 'center',
    width: 150,
    render: (info, rows) => {
      return (
        <div>
          <span style={{ marginRight: 6 }}>{info}</span>
          {rows?.intentOrderDateDiff ? (
            <span style={{ color: 'var(--error-color)' }}>{`(${rows?.intentOrderDateDiff})`}</span>
          ) : null}
        </div>
      )
    },
  },
  {
    title: '意向采购单状态',
    dataIndex: 'status',
    key: 'status',
    align: 'center',
    width: 110,
    render: (info) => {
      return <Badge color={intentBadgeColorMap[info]} text={INTENT_STATUS_TEXT[info] || '-'} />
    },
  },
  {
    title: '企划意向供应商',
    dataIndex: 'intentSupplierName',
    key: 'intentSupplierName',
    align: 'center',
    width: 180,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info}>
          {info || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '款式编码',
    dataIndex: 'spuCode',
    key: 'spuCode',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info}>
          {info || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '异常标签',
    dataIndex: 'tagInfo',
    key: 'tagInfo',
    align: 'center',
    width: 180,
    render: (info) => {
      return info && info.length > 0 ? (
        <Flex wrap gap={4} justify="center">
          {info?.map((item: any, index: number) => {
            return (
              <Tooltip key={index} placement="top" title={item?.remark}>
                <Tag color={[4, 6].includes(item?.tagId) ? 'error' : 'warning'}>
                  {TagTextMap[item?.tagId] || '未配置'}
                </Tag>
              </Tooltip>
            )
          })}
        </Flex>
      ) : (
        '-'
      )
    },
  },
  {
    title: '回复备注',
    dataIndex: 'replyRemark',
    key: 'replyRemark',
    align: 'center',
    width: 100,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info}>
          {info || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '意向到仓日期',
    dataIndex: 'planDate',
    key: 'planDate',
    align: 'center',
    width: 105,
    render: (info, rows) => {
      return (
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <div style={{ flex: 1, flexShrink: 0 }}>{info || '-'}</div>
          <Tooltip placement="top" title="编辑意向到仓日期">
            {rows.status === 0 && canEditPlanDate && (
              <EditOutlined
                style={{ color: 'var(--primary-color)', cursor: 'pointer' }}
                onClick={() => onEditTime(rows)}
              />
            )}
          </Tooltip>
        </div>
      )
    },
  },
  {
    title: '供应链回复到仓日期',
    dataIndex: 'requiredArrivalTime',
    key: 'requiredArrivalTime',
    align: 'center',
    width: 130,
    render: (info, rows) => {
      return <span style={{ color: rows?.arriveTimeDiffTag == 1 ? 'var(--error-color)' : '' }}>{info || '-'}</span>
    },
  },
  {
    title: '供应链跟单',
    dataIndex: 'trackOrderPerson',
    key: 'trackOrderPerson',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '正式采购单号',
    dataIndex: 'purchaseOrderCode',
    key: 'purchaseOrderCode',
    align: 'center',
    width: 240,
    ellipsis: {
      showTitle: false,
    },
    render: (info, rows) => {
      return info ? (
        <Tooltip
          placement="topLeft"
          title={
            info +
            (rows?.purchaseOrderStatus != null && rows?.purchaseOrderStatus >= 0
              ? '(' + ORDER_STATUS_TEXT[rows?.purchaseOrderStatus] + ')'
              : '')
          }
        >
          <Typography.Link onClick={() => navigate('/purchase/order/detail?id=' + rows?.purchaseOrderId)}>
            <div>
              <span style={{ marginRight: 3 }}>{info}</span>
              <span>
                {rows?.purchaseOrderStatus != null && rows?.purchaseOrderStatus >= 0
                  ? '(' + ORDER_STATUS_TEXT[rows?.purchaseOrderStatus] + ')'
                  : ''}
              </span>
            </div>
          </Typography.Link>
        </Tooltip>
      ) : (
        '-'
      )
    },
  },
  {
    title: '开发供应商',
    dataIndex: 'devSupplierName',
    key: 'devSupplierName',
    align: 'center',
    width: 180,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info}>
          {info || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '上市日期',
    dataIndex: 'releaseSeasonDate',
    key: 'releaseSeasonDate',
    align: 'center',
    width: 105,
    render: (info, rows) => {
      return (
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <span style={{ flex: 1, flexShrink: 0 }}>{info || '-'}</span>
          <Tooltip placement="top" title="编辑上市日期">
            {rows?.status === 0 && rows?.orderType == 0 && canEditPlanDate && (
              <EditOutlined
                style={{ color: 'var(--primary-color)', cursor: 'pointer' }}
                onClick={() => onEditRsTime(rows)}
              />
            )}
          </Tooltip>
        </div>
      )
    },
  },
  {
    title: '内箱数',
    dataIndex: 'inPackageNum',
    key: 'inPackageNum',
    align: 'center',
    width: 60,
    render: (info, rows) => {
      return (
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <span style={{ flex: 1, flexShrink: 0 }}>{info || '-'}</span>
          <Tooltip placement="top" title="编辑内箱数">
            {rows.status === 0 && rows?.orderType == 0 && canEditInOrOut && (
              <EditOutlined
                style={{ color: 'var(--primary-color)', cursor: 'pointer' }}
                onClick={() => onEditInOut({ ...rows, inorout: 1 })}
              />
            )}
          </Tooltip>
        </div>
      )
    },
  },
  {
    title: '外箱数',
    dataIndex: 'outPackageNum',
    key: 'outPackageNum',
    align: 'center',
    width: 60,
    render: (info, rows) => {
      return (
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <span style={{ flex: 1, flexShrink: 0 }}>{info || '-'}</span>
          <Tooltip placement="top" title="编辑外箱数">
            {rows.status === 0 && rows?.orderType == 0 && canEditInOrOut && (
              <EditOutlined
                style={{ color: 'var(--primary-color)', cursor: 'pointer' }}
                onClick={() => onEditInOut({ ...rows, inorout: 2 })}
              />
            )}
          </Tooltip>
        </div>
      )
    },
  },
  {
    title: '回复意向订单时间',
    dataIndex: 'replyIntentOrderTime',
    key: 'replyIntentOrderTime',
    align: 'center',
    width: 120,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '供应链回复状态',
    dataIndex: 'replyStatus',
    key: 'replyStatus',
    align: 'center',
    width: 100,
    render: (info) => {
      return info == 0 ? '已回复' : info == 1 ? '已驳回' : '-'
    },
  },

  {
    title: '供应链回复供应商',
    dataIndex: 'replySupplierName',
    key: 'replySupplierName',
    align: 'center',
    width: 180,
    ellipsis: {
      showTitle: false,
    },
    render: (info, rows) => {
      return (
        <Tooltip placement="topLeft" title={info}>
          <span style={{ color: rows?.supplierDiffTag == 1 ? 'var(--error-color)' : '' }}>{info || '-'}</span>
        </Tooltip>
      )
    },
  },
  {
    title: '供应链回复发货日期',
    dataIndex: 'replyDeliveryTime',
    key: 'replyDeliveryTime',
    align: 'center',
    width: 140,
    render: (info) => {
      return info || '-'
    },
  },

  {
    title: '操作',
    fixed: 'right',
    align: 'center',
    width: 280,
    render: (_, rows) => {
      return (
        <Space size={'large'}>
          {rows.status == 0 && (
            <PermissionLink
              permission="gylBatchReply"
              onClick={debounce(() => {
                setstatusFlag(false)
                onReply(rows, true)
              }, 400)}
            >
              供应链回复
            </PermissionLink>
          )}
          {rows.status == 0 && (
            <PermissionLink
              type="danger"
              permission="gylBatchReply"
              onClick={debounce(() => {
                setstatusFlag(true)
                onReply(rows, false)
              }, 400)}
            >
              驳回
            </PermissionLink>
          )}
          {rows.status == 1 && (
            <PermissionLink permission="planRejected" onClick={() => onRejectOrder(rows)}>
              企划驳回
            </PermissionLink>
          )}
          {(rows.status == 0 || rows.status == 1) && (
            <PermissionLink type="danger" permission="cancelIntentOrder" onClick={() => onDelOrder(rows)}>
              取消订单
            </PermissionLink>
          )}
          <Typography.Link onClick={() => onViewLogs(rows)}>查看日志</Typography.Link>
        </Space>
      )
    },
  },
]

export const useInnerColumns = ({
  onEdit,
  canEditOperation,
}: {
  onEdit: (info: ITableData) => void
  canEditOperation: boolean
}): TableColumnsType<ITableData> => [
  {
    title: '操作',
    dataIndex: 'op',
    key: 'op',
    align: 'center',
    fixed: 'left',
    hidden: !canEditOperation,
    onCell: (_, index) => {
      if (index === 0) {
        return {
          rowSpan: 999,
        }
      }
      return { rowSpan: 0 }
    },
    render: (_, rows) => {
      return (
        <Space size={'large'}>
          {rows?.status == 0 || rows?.status == 1 ? (
            <Tooltip placement="top" title="编辑">
              <EditOutlined style={{ color: 'var(--primary-color)', cursor: 'pointer' }} onClick={() => onEdit(rows)} />
            </Tooltip>
          ) : null}
        </Space>
      )
    },
  },
  {
    title: '序号',
    dataIndex: 'index',
    key: 'idx',
    align: 'center',
    render: (_, __, index) => {
      return index + 1
    },
  },
  {
    title: '款式编码',
    dataIndex: 'productSimpleVO',
    key: 'spuCode',
    align: 'center',
    render: (info) => {
      return info ? info?.spuCode : '-'
    },
  },
  {
    title: '助记码',
    dataIndex: 'productSimpleVO',
    key: 'designCode',
    align: 'center',
    render: (info) => {
      return info ? info?.designCode : '-'
    },
  },
  {
    title: '商品名称',
    dataIndex: 'productSimpleVO',
    key: 'spuName',
    align: 'center',
    render: (info) => {
      return info ? info?.spuName : '-'
    },
  },
  {
    title: '商品分类',
    dataIndex: 'productSimpleVO',
    key: 'className',
    align: 'center',
    render: (info) => {
      return info ? info?.className : '-'
    },
  },
  {
    title: '吊牌价',
    dataIndex: 'tagPrice',
    key: 'tagPrice',
    align: 'center',
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '商品条码',
    dataIndex: 'productSimpleVO',
    key: 'skuCode',
    align: 'center',
    render: (info) => {
      return info?.skuCode || '-'
    },
  },
  {
    title: '尺码',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '颜色',
    dataIndex: 'productSimpleVO',
    key: 'colorDetailName',
    align: 'center',
    render: (info) => {
      return info?.colorDetailName || '-'
    },
  },
  {
    title: '意向下单数量',
    dataIndex: 'orderQty',
    key: 'orderQty',
    align: 'center',
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '直营数量',
    dataIndex: 'directSaleQty',
    key: 'directSaleQty',
    align: 'center',
  },
  {
    title: '加盟数量',
    dataIndex: 'franchisingQty',
    key: 'franchisingQty',
    align: 'center',
  },
  {
    title: '电商数量',
    dataIndex: 'onlineQty',
    key: 'onlineQty',
    align: 'center',
  },
  {
    title: '首单下单价格',
    dataIndex: 'firstPurchasePrice',
    key: 'firstPurchasePrice',
    align: 'center',
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '上次下单价格',
    dataIndex: 'lastPurchasePrice',
    key: 'lastPurchasePrice',
    align: 'center',
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '企划意向价格',
    dataIndex: 'demandCostPrice',
    key: 'demandCostPrice',
    align: 'center',
    render: (info, rows) => {
      return <span style={{ color: rows?.priceDiffTag == 1 ? 'var(--error-color)' : '' }}>{info || '-'}</span>
    },
  },
  {
    title: '供应链回复价格',
    dataIndex: 'recoverCostPrice',
    key: 'recoverCostPrice',
    align: 'center',
    render: (info, rows) => {
      return <span style={{ color: rows?.priceDiffTag == 1 ? 'var(--error-color)' : '' }}>{info || '-'}</span>
    },
  },
  {
    title: '正式订单价格',
    dataIndex: 'purchasePrice',
    key: 'purchasePrice',
    align: 'center',
    render: (info) => {
      return info || '-'
    },
  },
]
export const useViewSkuColumns = ({
  onDel,
  viewList,
  setviewList,
  isCommonPrice,
}: {
  onDel: (info: ITableData) => void
  viewList: any[]
  setviewList: React.Dispatch<React.SetStateAction<any[]>>
  isCommonPrice: boolean
}): TableColumnsType<ITableData> => [
  {
    title: '操作',
    dataIndex: 'purchaseOrderCode',
    key: 'purchaseOrderCode',
    align: 'center',
    width: 100,
    fixed: 'left',
    render: (_, rows) => {
      return (
        <Space size={'large'}>
          <Tooltip placement="top" title="删除">
            <DeleteOutlined
              style={{ color: 'var(--error-color)', cursor: 'pointer' }}
              onClick={() => {
                if (viewList.length === 1) {
                  message.warning('至少保留一条数据！')
                  return
                }
                onDel(rows)
              }}
            />
          </Tooltip>
        </Space>
      )
    },
  },
  {
    title: '序号',
    dataIndex: 'purchaseOrderCode',
    key: 'purchaseOrderCode',
    align: 'center',
    width: 100,
    render: (_, __, index) => {
      return index + 1
    },
  },
  {
    title: '款式编码',
    dataIndex: 'productSimpleVO',
    key: 'spuCode',
    align: 'center',
    width: 100,
    render: (info) => {
      return info ? info?.spuCode : '-'
    },
  },
  {
    title: '助记码',
    dataIndex: 'productSimpleVO',
    key: 'designCode',
    align: 'center',
    width: 100,
    render: (info) => {
      return info ? info?.designCode : '-'
    },
  },
  {
    title: '商品名称',
    dataIndex: 'productSimpleVO',
    key: 'spuName',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info?.spuName}>
          {info?.spuName || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '商品分类',
    dataIndex: 'productSimpleVO',
    key: 'className',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info?.className}>
          {info?.className || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '吊牌价',
    dataIndex: 'tagPrice',
    key: 'tagPrice',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '商品条码',
    dataIndex: 'productSimpleVO',
    key: 'skuCode',
    align: 'center',
    width: 100,
    render: (info) => {
      return info?.skuCode || '-'
    },
  },
  {
    title: '尺码',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 100,
    render: (info) => {
      return info?.size || '-'
    },
  },
  {
    title: '颜色',
    dataIndex: 'productSimpleVO',
    key: 'colorDetailName',
    align: 'center',
    width: 100,
    render: (info) => {
      return info?.colorDetailName || '-'
    },
  },
  {
    title: '意向下单数量',
    dataIndex: 'orderQty',
    key: 'orderQty',
    align: 'center',
    width: 100,
    render: (info, rows) => {
      return (
        <div style={{ marginLeft: 16, marginRight: 16 }}>
          <InputNumber
            value={info || 0}
            precision={0}
            min={0}
            disabled
            // onChange={(val) => {
            //   rows.orderQty = val
            //   setviewList([...viewList])
            // }}
          ></InputNumber>
        </div>
      )
    },
  },
  {
    title: '直营数量',
    dataIndex: 'directSaleQty',
    key: 'directSaleQty',
    align: 'center',
    width: 100,
    render: (info, rows) => {
      return (
        <div style={{ marginLeft: 16, marginRight: 16 }}>
          <InputNumber
            value={info || 0}
            precision={0}
            min={0}
            onChange={(val) => {
              rows.directSaleQty = val
              rows.orderQty = val * 1 + Number(rows.franchisingQty || 0) + Number(rows.onlineQty || 0)
              setviewList([...viewList])
            }}
          ></InputNumber>
        </div>
      )
    },
  },
  {
    title: '加盟数量',
    dataIndex: 'franchisingQty',
    key: 'franchisingQty',
    align: 'center',
    width: 100,
    render: (info, rows) => {
      return (
        <div style={{ marginLeft: 16, marginRight: 16 }}>
          <InputNumber
            value={info || 0}
            precision={0}
            min={0}
            onChange={(val) => {
              rows.franchisingQty = val
              rows.orderQty = val + Number(rows.directSaleQty || 0) + Number(rows.onlineQty || 0)
              setviewList([...viewList])
            }}
          ></InputNumber>
        </div>
      )
    },
  },
  {
    title: '电商数量',
    dataIndex: 'onlineQty',
    key: 'onlineQty',
    align: 'center',
    width: 100,
    render: (info, rows) => {
      return (
        <div style={{ marginLeft: 16, marginRight: 16 }}>
          <InputNumber
            value={info || 0}
            precision={0}
            min={0}
            onChange={(val) => {
              rows.onlineQty = val
              rows.orderQty = val + Number(rows.franchisingQty || 0) + Number(rows.directSaleQty || 0)
              setviewList([...viewList])
            }}
          ></InputNumber>
        </div>
      )
    },
  },
  {
    title: '上次下单价格',
    dataIndex: 'lastPurchasePrice',
    key: 'lastPurchasePrice',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '企划意向价格',
    dataIndex: 'demandCostPrice',
    key: 'demandCostPrice',
    align: 'center',
    width: 100,
    render: (info, rows) => {
      return (
        <div style={{ marginLeft: 16, marginRight: 16 }}>
          <InputNumber
            value={info || 0}
            precision={2}
            min={0}
            onChange={(val) => {
              rows.demandCostPrice = val
              if (isCommonPrice) {
                const viewlist = viewList.map((item) => {
                  return {
                    ...item,
                    demandCostPrice: val,
                  }
                })
                setviewList([...viewlist])
              } else {
                const viewlist = viewList.map((item) => {
                  return {
                    ...item,
                    demandCostPrice:
                      rows?.productSimpleVO?.colorDetailName == item?.productSimpleVO?.colorDetailName
                        ? val
                        : item.demandCostPrice,
                  }
                })
                setviewList([...viewlist])
              }
            }}
          ></InputNumber>
        </div>
      )
    },
  },
]
export const useReplyColumns = ({
  viewList,
  setviewList,
  isCommonPrice,
  DisabledPrice,
}: {
  viewList: any[]
  setviewList: React.Dispatch<React.SetStateAction<any[]>>
  isCommonPrice: boolean
  DisabledPrice: boolean
}): TableColumnsType<ITableData> => [
  {
    title: '序号',
    dataIndex: 'purchaseOrderCode',
    key: 'purchaseOrderCode',
    align: 'center',
    width: 65,
    render: (_, __, index) => {
      return index + 1
    },
  },
  {
    title: '商品名称',
    dataIndex: 'productSimpleVO',
    key: 'spuName',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info?.spuName}>
          {info?.spuName || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '商品条码',
    dataIndex: 'productSimpleVO',
    key: 'skuCode',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info?.skuCode}>
          {info?.skuCode || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '颜色',
    dataIndex: 'productSimpleVO',
    key: 'colorDetailName',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info?.colorDetailName}>
          {info?.colorDetailName || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '尺码',
    dataIndex: 'productSimpleVO',
    key: 'size',
    align: 'center',
    width: 120,
    ellipsis: {
      showTitle: false,
    },
    render: (info) => {
      return (
        <Tooltip placement="topLeft" title={info?.size}>
          {info?.size || '-'}
        </Tooltip>
      )
    },
  },
  {
    title: '吊牌价',
    dataIndex: 'tagPrice',
    key: 'tagPrice',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '意向下单数量',
    dataIndex: 'orderQty',
    key: 'orderQty',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '吊牌价',
    dataIndex: 'tagPrice',
    key: 'tagPrice',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '上次下单价格',
    dataIndex: 'lastPurchasePrice',
    key: 'lastPurchasePrice',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '企划意向价格',
    dataIndex: 'demandCostPrice',
    key: 'demandCostPrice',
    align: 'center',
    width: 100,
    render: (info) => {
      return info || '-'
    },
  },
  {
    title: '供应链回复价格',
    dataIndex: 'recoverCostPrice',
    key: 'recoverCostPrice',
    align: 'center',
    width: 120,
    render: (info, rows) => {
      return (
        <div style={{ marginLeft: 16, marginRight: 16 }}>
          <InputNumber
            disabled={DisabledPrice}
            value={info || 0}
            precision={2}
            min={0}
            onChange={(val) => {
              rows.recoverCostPrice = val
              if (isCommonPrice) {
                const viewlist = viewList.map((item) => {
                  return {
                    ...item,
                    recoverCostPrice: val,
                  }
                })
                setviewList([...viewlist])
              } else {
                const viewlist = viewList.map((item) => {
                  return {
                    ...item,
                    recoverCostPrice:
                      rows?.productSimpleVO?.colorDetailName == item?.productSimpleVO?.colorDetailName
                        ? val
                        : item.recoverCostPrice,
                  }
                })
                setviewList([...viewlist])
              }
            }}
          ></InputNumber>
        </div>
      )
    },
  },
]
